﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;
using Model;

namespace Web.Admin.NavItem
{
    public partial class Item : BaseCode.BaseAdmin
    {
        private string path = System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["titlexmlPath"]);

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }

        public void bind()
        {
            List<Title> list = XMLLib.getTitle(path);
            Repeater1.DataSource = list;
            this.Repeater1.DataBind();
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "remove")
            {
                string strid = e.CommandArgument.ToString();
                XMLLib.DelteTitle(strid, path);
                bind();
            }
        }
    }
}